package com.ex.ui;

import java.awt.EventQueue; 
import javax.swing.JInternalFrame;
import javax.swing.JPanel; 

@SuppressWarnings("serial")
public class MyInternalFrame extends JInternalFrame {

	 /**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MyInternalFrame frame = new MyInternalFrame(null);
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	 static int openFrameCount = 0;
	    static final int xOffset = 30, yOffset = 30;
	/**
	 * Create the frame.
	 */
	public MyInternalFrame(JPanel panel) {
		//setBounds(15, 20, 320, 230);
		 
		 super(panel.getToolTipText() + openFrameCount, 
	              true, //resizable
	              true, //closable
	              true, //maximizable
	              true);//iconifiable
		 
	 		
		 setSize(panel.getWidth(),panel.getHeight());
		   
	     setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
				 
		this.getContentPane().add(panel);
		openFrameCount++; 
	} 
}
